﻿
/*----------------------------------------------------------------//
// 文件名：MoCoTestItem.cs
// 文件功能描述：实体 MoCoTestItem.
// 
// 创建标识：Template  ver 5.0.20090429 2009-11-20
//
// 修改标识：
// 修改描述：
//----------------------------------------------------------------*/
#region MoCoTestItem
using System;
using System.Data;
namespace EQT.Model
{
    /// <summary>
    /// 业务实体MoCoTestItem
    /// </summary>
    public partial class MoCoTestItem : ICloneable
    {
        #region 表CoTestItem的字段
        private string coItemId;
        private string reportId;
        private string itemCode;
        private string itemTitle;
        private string testParameters;
        private decimal price;
        private string chargeDeptCode;
        private DateTime sampleRevDate;
        private string chargeMaster;
        private DateTime taskAssignDate;
        private DateTime testBeginDate;
        private DateTime testFinishDate;
        private int testStatus;
        private DateTime lastStatusTime;
        #endregion

        #region 构造函数
        public MoCoTestItem()
        {
            sampleRevDate = new DateTime(1900, 1, 1); taskAssignDate = new DateTime(1900, 1, 1); testBeginDate = new DateTime(1900, 1, 1); testFinishDate = new DateTime(1900, 1, 1); lastStatusTime = new DateTime(1900, 1, 1);

        }
        #endregion

        #region 拷贝构造函数

        public MoCoTestItem(MoCoTestItem item)
        {
            item.CopyTo(this);
        }
        #endregion

        #region 带参数构造函数
        public MoCoTestItem(string coItemId, string reportId, string itemCode, string itemTitle, string testParameters, decimal price, string chargeDeptCode, DateTime sampleRevDate, string chargeMaster, DateTime taskAssignDate, DateTime testBeginDate, DateTime testFinishDate, int testStatus, DateTime lastStatusTime)
        {
            this.coItemId = coItemId;
            this.reportId = reportId;
            this.itemCode = itemCode;
            this.itemTitle = itemTitle;
            this.testParameters = testParameters;
            this.price = price;
            this.chargeDeptCode = chargeDeptCode;
            this.sampleRevDate = sampleRevDate;
            this.chargeMaster = chargeMaster;
            this.taskAssignDate = taskAssignDate;
            this.testBeginDate = testBeginDate;
            this.testFinishDate = testFinishDate;
            this.testStatus = testStatus;
            this.lastStatusTime = lastStatusTime;
        }
        #endregion

        #region 表CoTestItem的字段属性
        /// <summary>
        /// CO_ITEM_ID
        /// </summary>
        public string CoItemId
        {
            get { return coItemId; }
            set { coItemId = value; }
        }
        /// <summary>
        ///编号规则为NO. LDYYMMXXX，其中NO.LD为固定前缀，YY表示年份，MM代表月份，XXX代表当月第几个报告。XXX为业务组手工录入。此编号不能重复。报告编号做为唯一值编号贯穿于整个系统流程（包括财务、业务、试验、报告等各部门）
        /// </summary>
        public string ReportId
        {
            get { return reportId; }
            set { reportId = value; }
        }
        /// <summary>
        /// ITEM_CODE
        /// </summary>
        public string ItemCode
        {
            get { return itemCode; }
            set { itemCode = value; }
        }
        /// <summary>
        /// ITEM_TITLE
        /// </summary>
        public string ItemTitle
        {
            get { return itemTitle; }
            set { itemTitle = value; }
        }
        /// <summary>
        /// TEST_PARAMETERS
        /// </summary>
        public string TestParameters
        {
            get { return testParameters; }
            set { testParameters = value; }
        }
        /// <summary>
        /// PRICE
        /// </summary>
        public decimal Price
        {
            get { return price; }
            set { price = value; }
        }
        /// <summary>
        /// CHARGE_DEPT_CODE
        /// </summary>
        public string ChargeDeptCode
        {
            get { return chargeDeptCode; }
            set { chargeDeptCode = value; }
        }
        /// <summary>
        /// SAMPLE_REV_DATE
        /// </summary>
        public DateTime SampleRevDate
        {
            get { return sampleRevDate; }
            set { sampleRevDate = value; }
        }
        /// <summary>
        /// CHARGE_MASTER
        /// </summary>
        public string ChargeMaster
        {
            get { return chargeMaster; }
            set { chargeMaster = value; }
        }
        /// <summary>
        ///将计划执行日期改成任务下发日期
        /// </summary>
        public DateTime TaskAssignDate
        {
            get { return taskAssignDate; }
            set { taskAssignDate = value; }
        }
        /// <summary>
        /// TEST_BEGIN_DATE
        /// </summary>
        public DateTime TestBeginDate
        {
            get { return testBeginDate; }
            set { testBeginDate = value; }
        }
        /// <summary>
        /// TEST_FINISH_DATE
        /// </summary>
        public DateTime TestFinishDate
        {
            get { return testFinishDate; }
            set { testFinishDate = value; }
        }
        /// <summary>
        ///0=无效，1=未开始，2=进行中，3=已完成
        /// </summary>
        public int TestStatus
        {
            get { return testStatus; }
            set { testStatus = value; }
        }
        /// <summary>
        /// LAST_STATUS_TIME
        /// </summary>
        public DateTime LastStatusTime
        {
            get { return lastStatusTime; }
            set { lastStatusTime = value; }
        }
        #endregion

        #region 辅助函数
        /// <summary>
        /// 拷贝函数
        /// </summary>
        public MoCoTestItem CopyTo(MoCoTestItem item)
        {
            item.coItemId = this.coItemId;
            item.reportId = this.reportId;
            item.itemCode = this.itemCode;
            item.itemTitle = this.itemTitle;
            item.testParameters = this.testParameters;
            item.price = this.price;
            item.chargeDeptCode = this.chargeDeptCode;
            item.sampleRevDate = this.sampleRevDate;
            item.chargeMaster = this.chargeMaster;
            item.taskAssignDate = this.taskAssignDate;
            item.testBeginDate = this.testBeginDate;
            item.testFinishDate = this.testFinishDate;
            item.testStatus = this.testStatus;
            item.lastStatusTime = this.lastStatusTime;
            return item;
        }
        /// <summary>
        /// 克隆函数
        /// </summary>		
        public object Clone()
        {
            MoCoTestItem mo = new MoCoTestItem();
            mo.CoItemId = this.CoItemId;
            mo.ReportId = this.ReportId;
            mo.ItemCode = this.ItemCode;
            mo.ItemTitle = this.ItemTitle;
            mo.TestParameters = this.TestParameters;
            mo.Price = this.Price;
            mo.ChargeDeptCode = this.ChargeDeptCode;
            mo.SampleRevDate = this.SampleRevDate;
            mo.ChargeMaster = this.ChargeMaster;
            mo.TaskAssignDate = this.TaskAssignDate;
            mo.TestBeginDate = this.TestBeginDate;
            mo.TestFinishDate = this.TestFinishDate;
            mo.TestStatus = this.TestStatus;
            mo.LastStatusTime = this.LastStatusTime;
            return mo;
        }
        ///<summary>
        ///判断对象是否相等
        ///<summary>
        public override bool Equals(object obj)
        {
            if (object.ReferenceEquals(this, obj))
            {
                return true;
            }
            else
            {
                MoCoTestItem NewCoTestItem = obj as MoCoTestItem;
                if (NewCoTestItem == null)
                {
                    return false;
                }
                else
                {
                    if (NewCoTestItem.CoItemId == this.CoItemId && NewCoTestItem.ReportId == this.ReportId && NewCoTestItem.ItemCode == this.ItemCode && NewCoTestItem.ItemTitle == this.ItemTitle && NewCoTestItem.TestParameters == this.TestParameters && NewCoTestItem.Price == this.Price && NewCoTestItem.ChargeDeptCode == this.ChargeDeptCode && NewCoTestItem.SampleRevDate == this.SampleRevDate && NewCoTestItem.ChargeMaster == this.ChargeMaster && NewCoTestItem.TaskAssignDate == this.TaskAssignDate && NewCoTestItem.TestBeginDate == this.TestBeginDate && NewCoTestItem.TestFinishDate == this.TestFinishDate && NewCoTestItem.TestStatus == this.TestStatus && NewCoTestItem.LastStatusTime == this.LastStatusTime)
                    {
                        return true;
                    }
                }

            }
            return false;

        }
        ///TODO:you should modify GetHashCode by yourself.
        public override int GetHashCode()
        {
            return base.GetHashCode();
        }

        public override string ToString()
        {
            return String.Format(System.Globalization.CultureInfo.InvariantCulture, "CoItemId={0}/ReportId={1}/ItemCode={2}/ItemTitle={3}/TestParameters={4}/Price={5}/ChargeDeptCode={6}/SampleRevDate={7}/ChargeMaster={8}/TaskAssignDate={9}/TestBeginDate={10}/TestFinishDate={11}/TestStatus={12}/LastStatusTime={13}", coItemId, reportId, itemCode, itemTitle, testParameters, price, chargeDeptCode, sampleRevDate, chargeMaster, taskAssignDate, testBeginDate, testFinishDate, testStatus, lastStatusTime);

        }
        #endregion


        #region DataTable Help Function
        ///<summary>
        ///DataRow转换成Model
        ///</summary>
        public void Row2Model(DataRow row)
        {
            if (row["Co_Item_ID"] != null && row["Co_Item_ID"] != DBNull.Value)
            {
                this.CoItemId = (string)row["Co_Item_ID"];
            }
            else
            {
                this.CoItemId = string.Empty;
            }
            if (row["Report_ID"] != null && row["Report_ID"] != DBNull.Value)
            {
                this.ReportId = (string)row["Report_ID"];
            }
            else
            {
                this.ReportId = string.Empty;
            }
            if (row["Item_Code"] != null && row["Item_Code"] != DBNull.Value)
            {
                this.ItemCode = (string)row["Item_Code"];
            }
            else
            {
                this.ItemCode = string.Empty;
            }
            if (row["Item_Title"] != null && row["Item_Title"] != DBNull.Value)
            {
                this.ItemTitle = (string)row["Item_Title"];
            }
            else
            {
                this.ItemTitle = string.Empty;
            }
            if (row["Test_Parameters"] != null && row["Test_Parameters"] != DBNull.Value)
            {
                this.TestParameters = (string)row["Test_Parameters"];
            }
            else
            {
                this.TestParameters = string.Empty;
            }
            if (row["Price"] != null && row["Price"] != DBNull.Value)
            {
                this.Price = (decimal)row["Price"];
            }
            else
            {
                this.Price = 0;
            }
            if (row["Charge_Dept_Code"] != null && row["Charge_Dept_Code"] != DBNull.Value)
            {
                this.ChargeDeptCode = (string)row["Charge_Dept_Code"];
            }
            else
            {
                this.ChargeDeptCode = string.Empty;
            }
            if (row["Sample_Rev_Date"] != null && row["Sample_Rev_Date"] != DBNull.Value)
            {
                this.SampleRevDate = (DateTime)row["Sample_Rev_Date"];
            }
            else
            {
                this.SampleRevDate = DateTime.MinValue;
            }
            if (row["Charge_Master"] != null && row["Charge_Master"] != DBNull.Value)
            {
                this.ChargeMaster = (string)row["Charge_Master"];
            }
            else
            {
                this.ChargeMaster = string.Empty;
            }
            if (row["Task_Assign_Date"] != null && row["Task_Assign_Date"] != DBNull.Value)
            {
                this.TaskAssignDate = (DateTime)row["Task_Assign_Date"];
            }
            else
            {
                this.TaskAssignDate = DateTime.MinValue;
            }
            if (row["Test_Begin_Date"] != null && row["Test_Begin_Date"] != DBNull.Value)
            {
                this.TestBeginDate = (DateTime)row["Test_Begin_Date"];
            }
            else
            {
                this.TestBeginDate = DateTime.MinValue;
            }
            if (row["Test_Finish_Date"] != null && row["Test_Finish_Date"] != DBNull.Value)
            {
                this.TestFinishDate = (DateTime)row["Test_Finish_Date"];
            }
            else
            {
                this.TestFinishDate = DateTime.MinValue;
            }
            if (row["Test_Status"] != null && row["Test_Status"] != DBNull.Value)
            {
                this.TestStatus = (int)row["Test_Status"];
            }
            else
            {
                this.TestStatus = 0;
            }
            if (row["Last_Status_Time"] != null && row["Last_Status_Time"] != DBNull.Value)
            {
                this.LastStatusTime = (DateTime)row["Last_Status_Time"];
            }
            else
            {
                this.LastStatusTime = DateTime.MinValue;
            }
        }

        ///<summary>
        ///Model转换成DataRow
        ///</summary>
        public void Model2Row(DataRow row)
        {
            row["Co_Item_ID"] = this.CoItemId;
            row["Report_ID"] = this.ReportId;
            row["Item_Code"] = this.ItemCode;
            row["Item_Title"] = this.ItemTitle;
            row["Test_Parameters"] = this.TestParameters;
            row["Price"] = this.Price;
            row["Charge_Dept_Code"] = this.ChargeDeptCode;
            row["Sample_Rev_Date"] = this.SampleRevDate;
            row["Charge_Master"] = this.ChargeMaster;
            row["Task_Assign_Date"] = this.TaskAssignDate;
            row["Test_Begin_Date"] = this.TestBeginDate;
            row["Test_Finish_Date"] = this.TestFinishDate;
            row["Test_Status"] = this.TestStatus;
            row["Last_Status_Time"] = this.LastStatusTime;
        }
        #endregion
    }
}
#endregion
